package model

import (
	config "gitee.com/lanshiren/miniprogram/app/conf"
)

type Status struct {
	Name string `json:"name"`
	V  string `json:"v"`
}

func GetGlobalStatus() ([]*Status, error) {
	db := config.GetDB()
	var status []*Status
	var VariableName, Value string
	rows, err := db.Raw("show global status").Rows()
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	for rows.Next() {
		if err := rows.Scan(&VariableName, &Value); err != nil {
			return nil, err
		}
		// 业务逻辑...
		status = append(status, &Status{Name: VariableName, V: Value})
	}
	return status, nil
}
